package cn.itsource.realm;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 交给spring管理的bean，在其内部可以任意注入spring管理的bean
 */
public class MyFilterChainDefinitionMap {

    /*@Autowired
    private IPermissionService permissionService;*/

    public Map<String,String> createMap(){
        Map<String, String> map = new LinkedHashMap<>();
        map.put("/login","anon");
        /*static下面的资源都要放行*/
        map.put("/static/**", "anon");
        map.put("*.css", "anon");
        map.put("*.js", "anon");
        /*swagger相关*/
        map.put("/swagger-ui.*", "anon");
        map.put("/swagger*", "anon");
        map.put("/webjars/**", "anon");
        map.put("/images/**", "anon");
        map.put("/configuration/**", "anon");
        map.put("/v2/**", "anon");

        map.put("/logout","logout");
        //查询所有的权限
        /*List<Permission> permissions = permissionService.findAll();
        for (Permission permission : permissions) {
            *//*使用自定义过滤器*//*
            map.put(permission.getUrl(),"itsourcePermission["+permission.getSn()+"]");
        }*/
        map.put("/**","anon");
//        map.put("/**","myAuthc");
        return map;
    }

}
